<?php

namespace app\admin\model\sport;

use think\Model;
use app\admin\model\sport\Area;
use app\admin\model\sport\Teacher;


class SUser extends Model
{

    

    

    // 表名
    protected $name = 'sport_user';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'feedback_status_text'
    ];
    

    
    public function getFeedbackStatusList()
    {
        return ['0' => __('Feedback_status 0'), '1' => __('Feedback_status 1'), '2' => __('Feedback_status 2')];
    }


    public function getFeedbackStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['feedback_status']) ? $data['feedback_status'] : '');
        $list = $this->getFeedbackStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function area()
    {
        return $this->belongsTo(Area::class, 'sport_area_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function teacher()
    {
        return $this->belongsTo(Teacher::class, 'sport_teacher_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

}
